home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / trace1a.arc / TRACE.DOC < prev    next >
Encoding:
Text File  |  1987-02-04  |  8.0 KB  |  178 lines

  1.                 TRACE - Interrupt Tracer version 1.21 01/26/86
  2.  
  3.                           Written by Joan Riff for:
  4.                      Computerwise Consulting Services 
  5.  
  6.                  P.O. Box 813, McLean VA 22101  (703) 280-2809
  7.  
  8.                Documented and Enhanced 01/26/87  by A. B. Krueger 
  9.  
  10.         Contact: ARNY KRUEGER at the EXEC-PC BBS in Shorewood Wisconson.
  11.  
  12.  
  13. TRACE is a TSR program that traces interupts.
  14.  
  15.                 It:
  16.  
  17.                  * traps interrupt's
  18.                  * traces the registers at the entry to the interrupt, 
  19.                  * executes the interrupt itself
  20.                  * optionally traces the registers at exit from the interrupt. 
  21.  
  22. TRACE also allows the user at the keyboard to display  this traced information, 
  23. either on the screen or at the printer.  
  24.  
  25. The interrupt's that are to be traced are specified in the ICT table in the 
  26. source code. Once defined, they may be enabled or disabled from the keyboard.  
  27. A default ICT is provided and you should not modify it until you understand how 
  28. TRACE is used and how it works.  
  29.  
  30.       <<< REBOOT AS SOON AS POSSIBLE AFTER INVOKING TRACE!!! >>>
  31.  
  32. TRACE is not foolproof or bugfree. Use it as a tool for finding out what DOS 
  33. and DOS programs do. You use it at your own risk.  When you have a printout of 
  34. the trace activity that interests you, reboot your system.  It may not be long 
  35. for this world! Don't say that you weren't warned.  
  36.  
  37.  
  38.       Usage is: TRACE [size]  
  39.  
  40.           where: size is the size of the trace table in K
  41.                  between 10 and 63, default is 30
  42.  
  43.  
  44. Known problems:
  45.  
  46.    *   Programs that use:  INT 21h function E0h
  47.  
  48.    *   Relay Gold Release 2.0
  49.  
  50.    *   Programs that use INT 2Eh
  51.  
  52.    *   Keyboard ICT control for ICT's 7-15 is flakey
  53.  
  54.  
  55.  
  56. How it works:
  57.  
  58.    TRACE initialization code is in TRACE12.ASM.  At initialization, TRACE 
  59.    initializes its Interrupt Control Table (ICT).  The ICT contains one element 
  60.    for every interrupt number or subset thereof to be traced. Tracing control 
  61.    within a given interrupt number is determined by the value of AH. Interrupts 
  62.    vary as to whether they return to the caller, or not. INT 20 (program exit) 
  63.    is an example of an interrupt that does not return to the caller. Treatment 
  64.    of the 808x flags at return also varies, and is controlled by the ICT. DOS 
  65.    INT 21 function 25 is used to route interrupts to TRACE entry points.  
  66.  
  67.    The ICT entries are laid out in TRACE1E.AIC, and defined in TRACE1.ASM.  
  68.    Further documentation about  ICT's is located there, for easy reference.  
  69.    There are 16 possible different ICT entries. The first 12 are used, leaving 
  70.    4 for future expansion. The first 12 are not sacrosanct, but an entry 
  71.    covering INT 21H  0D0h < AH < 0FFh is recommended. TRACE traps  INT 21h to 
  72.    protect itself against being loaded twice.  
  73.  
  74.    TRACE allocates a trace table in accordance with the calling parameter.
  75.    If none is provided, 30K is used as a default. The trace table size is 
  76.    forced to be between 10K and 64K. If below 10K, the table would be smaller
  77.    than the program that controls it, which makes little sense. The 64K limit 
  78.    comes from the 808x segment size.
  79.  
  80.    When a interrupt to be TRACEd takes place, TRACE stores register and flag 
  81.    information in the trace table, with a header that tells what kind of 
  82.    interrupt trace entry this is. If post-interrupt tracing is requested, then 
  83.    some carry-forward information is placed on the stack, and control is passed 
  84.    to the interrupt handler that was in place when TRACE was initialized. After 
  85.    the original interrupt handler returns, TRACE stores stores register and 
  86.    flag information in the trace table, with a header that tells what kind of 
  87.    interrupt trace entry this is. If the interrupt table is full, tracing ends.
  88.  
  89.    When TRACE is entered via Shift-PrtSC, or from Periscope via INT 60h,
  90.    TRACE's command processor prompts for output and trace control commands, 
  91.    which are single letters. One important command is "Q" for QUIT, which 
  92.    returns control to DOS. The Output routing options are printer or screen. 
  93.    Print output enables displaying TRACE data without affecting the screen's 
  94.    display, as well as making hard-copy for reference. The enable and disable 
  95.    options allow the status of individual ICT's to be altered. The "T" command 
  96.    actually lists the trace, or selected data, by ICT number. The "L" command
  97.    lists the ICT status. The "C" command clears the trace table and ICT count 
  98.    fields.
  99.  
  100.    The ICT for INT 21h subfunctions 00-09 are usually disabled because there 
  101.    is a lot of uninformative action in this range, for keyboard and screen I/O.
  102.    It would not be too wise to try to trace INT 10h and 17h, as they are used 
  103.    by TRACE.
  104.  
  105.  
  106. How and Why to Modify TRACE:
  107.  
  108.    When TRACE displays trace table data, it is formatted and self-explanitory.
  109.    Each known interrupt is tagged with identifying text, and the register and 
  110.    flag contents are labeled and described. Tables in TRACE1.AIC control this 
  111.    for interrupts 13H and 21h.  TRACE11.ASM contains most of the formatting 
  112.    subroutines and secondary tables. 
  113.  
  114.    Note that TRACE11 contains a PRINT_EDIT subroutine that is capable of 
  115.    sophisticated output formatting using flag bytes EDIT_xxxx, which are 
  116.    defined in TRACE1E.AIC.  
  117.  
  118.    TRACE1E.AIC changes can affect all three .ASM files. If you change TRACE1E, 
  119.    figure on re-assembling TRACE1, TRACE11, and  TRACE12.  Normally, updating 
  120.    the TRACE1 ICT definitions necessitates re-assembling only TRACE1. Link
  121.    TRACE using the command:
  122.  
  123.                LINK TRACE1+TRACE11+TRACE12,TRACE;
  124.  
  125.    Convert TRACE to a COM file using:
  126.  
  127.                EXE2BIN TRACE.EXE TRACE.COM
  128.  
  129.  
  130. How to use TRACE:
  131.  
  132.    Initialize TRACE using the command:
  133.  
  134.                     TRACE
  135.  
  136.    If TRACE is already in place it will type an error message, but no harm will 
  137.    be done.
  138.  
  139.    When you trace, we encourage you to use the Shift-PrtSc key to interrupt the 
  140.    opeation of complex programs, and clear the trace table so that the contents 
  141.    of the trace table are relevant to your study. Some programs trap INT 5, and 
  142.    will keep you from getting into TRACE using Shift-PrtSc, until they 
  143.    complete.  
  144.  
  145.    TRACE has been upgraded to be fairly stable. In its original form Interuupts 
  146.    20h, 27h, 21h with AH=31h and 21h with AH=4Ch would cause it to crash often.  
  147.    It is your responsibility to alter the operational environment or modify 
  148.    TRACE to stay intact through the operation you are TRACing.  
  149.  
  150.    TRACE will impact the performance of  your PC when it is running, especially 
  151.    if the trace table is not yet full. It provides a means for understanding 
  152.    the control and flow of programs like DOS itself, for which you have no 
  153.    source code or internals documentation. One trick is to use TRACE  CS:IP 
  154.    values to get a IP value that you subsequently use with DEBUG to trace the 
  155.    area of interest.  
  156.  
  157.    Trace information can also be used to find out which program code inspects 
  158.    or updates specific parts of a disk that are known to contain information of 
  159.    interest.  You may have to work back from an INT 13 or INT 24 entry to do 
  160.    this.  You will have to identify the location on disk by drive, side, track, 
  161.    and sector number. There are several disk utilities that will help you do 
  162.    this such as NORTON's utilities, IBM's DiskRepair, or Central Point's PC 
  163.    TOOLs.  
  164.  
  165.    When running TRACE, you may notice a large number of DOS INT 21h AH=3E
  166.    calls as DOS closes file handles 5-19 once per keyboard or .BAT file 
  167.    command.  If this bothers you, you can modify the ICT table to disable
  168.    TRACEing this interrupt. Note that there is one pass through TRACE's 
  169.    interrupt handlers for every different range of AH you define in the ICT's, 
  170.    until the correct ICT is found.
  171.  
  172.    Any insights about TRACE that you route to the author will be appreciated!
  173.    Contact ARNY KRUEGER at the EXEC-PC BBS, or daytime voice phone 
  174.    313-583-9610.  
  175.  
  176.  
  177.  
  178.